package com.eling.elcms.travel.model;

import com.eling.elcms.basedoc.model.EnumSerializer;
import com.eling.elcms.core.dao.annotation.In;
import com.eling.elcms.core.dao.hibernate.search.EnumBridge;
import com.eling.elcms.core.model.BaseModel;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FieldBridge;
import org.hibernate.search.annotations.Indexed;

import javax.persistence.*;

/**
 * 车辆档案
 * @author ZhaoYuJing
 *
 */
@Entity
@Table(name = "bd_car")
@Indexed

public class Car extends BaseModel {


	private static final long serialVersionUID = -483249048059508529L;

	@Id
	@In
	@DocumentId
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long pkCar;
	
	/** 车辆型号  */
	@Column
	@Field
	private String carType;
	
	
	/** 车牌号  */
	@Column
	@Field
	private String carNumber;
	
	
	/** 准乘人数  */
	@Column
	@Field
	private Integer perNmber;
	
	
	/** 最大行李数 */
	@Column
	@Field
	private Integer maxBagNumber;
	
	
	/** 车辆状态  */
	@Enumerated(EnumType.STRING)
	@Field
	@FieldBridge(impl = EnumBridge.class)
	@In
	private CarStatus carStatus;
	
	@Version
	private Integer version;

	/** 封存 */
	@Field
	@Column
	private Boolean seal;
	
	@JsonSerialize(using = EnumSerializer.class)
	public enum CarStatus {
		Running("出车"),Free("空闲");

		private String display;

		CarStatus(String display) {
			this.display = display;
		}

		public String getDisplay() {
			return display;
		}
	}
	
	
	public Long getPkCar() {
		return pkCar;
	}

	public void setPkCar(Long pkCar) {
		this.pkCar = pkCar;
	}

	public String getCarType() {
		return carType;
	}

	public void setCarType(String carType) {
		this.carType = carType;
	}

	public String getCarNumber() {
		return carNumber;
	}

	public void setCarNumber(String carNumber) {
		this.carNumber = carNumber;
	}

	public Integer getPerNmber() {
		return perNmber;
	}

	public void setPerNmber(Integer perNmber) {
		this.perNmber = perNmber;
	}

	public Integer getMaxBagNumber() {
		return maxBagNumber;
	}

	public void setMaxBagNumber(Integer maxBagNumber) {
		this.maxBagNumber = maxBagNumber;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	public CarStatus getCarStatus() {
		return carStatus;
	}

	public void setCarStatus(CarStatus carStatus) {
		this.carStatus = carStatus;
	}

	public Boolean getSeal() {
		return seal;
	}

	public void setSeal(Boolean seal) {
		this.seal = seal;
	}
	
	
	

}
